<template>
  <a-list :grid="{ gutter: 15, column: 2 }" :data-source="nodeList">
    <template #renderItem="{ item }">
      <a-list-item>
        <div draggable="true" @dragstart="dragNode(item.type, belongTo)">
<!--          <component :is="item.icon" />-->
          <image :src="item.icon" alt="Example Image" />
        </div>
      </a-list-item>
    </template>
  </a-list>
</template>
<script lang="ts" setup>
  import { PropType } from 'vue';
  import { IElement, NodesType } from '/@/type/index';
  import { HighNodeTypeEnum, NodeTypeEnum } from '/@/type/enums';
  import { CommonNodeTypeEnum } from '/@/type/enums';

  defineProps({
    nodeList: {
      type: Array as PropType<IElement[]>,
      default: () => [],
    },
    belongTo: {
      type: String as PropType<NodeTypeEnum>,
      default: '',
    },
  });

  const emits = defineEmits(['setDragInfo']);

  // 开始拖拽
  function dragNode(type: string, belongTo: string) {
    emits('setDragInfo', {
      type,
      belongTo,
    });
  }
</script>
